public class SZSum {
    //实现一个方法 sum, 以数组为参数, 求数组所有元素之和
    public static void main(String[] args) {
        int[] array ={1,2,3,4,5,6,7,8,9};
        sum(array);
    }
    public static void sum(int[] array) {
        int sum = 0;
        for (int i = 0; i < array.length; i++) {
            sum += array[i];
        }
        System.out.println(sum);
    }
}
